/**
 * @Author: 健聪
 * @Description: 继承中的构造方法
 * @Date: 2024/1/29
 */
void main() {
  var student = new Student("Tom", "Male");

  print("Student name is ${student.name}, gender is ${student.gender}");
}

class Person {
  String? name;

  // Person() {
  //   print("Person...");
  // }
  Person(this.name);
  Person.withName(this.name);
}

class Student extends Person {
  int? age;
  final String gender;

  // 初始化列表必须写在调用父类方法的前面
  Student(String name, String g) : gender = g, super.withName(name);
  // Student(super.name);
}